package com.cet.designpatterns.visitor;

import java.util.LinkedList;
import java.util.List;

/**
 * @program: algorithm
 * @description: ObjectStructure，管理很多Person
 * @author: 陈恩涛
 * @create: 2021-09-19 23:23
 **/
public class ObjectStructure {

    private List<Person> elements = new LinkedList<>();

    public void attach(Person person) {
        elements.add(person);
    }

    public void detach(Person person) {
        elements.remove(person);
    }

    public void display(Action action) {
        for (Person element : elements) {
            element.accept(action);
        }
    }
}

/*
* qz:男女评价不同怎么做
* */
